package com.ruoyi.web.controller.intelligence;

import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.intelligence.chat.aliyun.TyqwFactory;
import com.ruoyi.intelligence.chat.aliyun.TywxFactory;
import com.ruoyi.intelligence.bo.MsgBo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author: wxj
 * 阿里云
 * @Date: 2023/11/23
 */
@SaIgnore
@Slf4j
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("intelligence/aliyun")
public class AliyunController {

        private final TyqwFactory tyqwFactory;
        private final TywxFactory tywxFactory;

    /**
     * 通义千问
     * @param
     * @param
     * @return
     * @throws NoApiKeyException
     * @throws InputRequiredException
     */
    @GetMapping("/tyqw")
    public R<String> qytw(@RequestBody MsgBo msgBo) throws NoApiKeyException, InputRequiredException {
       // String s = tyqwFactory.callWithListMessage(msgBo.getMsgList(), msgBo.getNewMsg());
        return R.ok();
    }

    /**
     * 通义万象
     * @param
     * @param
     * @return
     * @throws NoApiKeyException
     * @throws InputRequiredException
     */
    @GetMapping("/tywx")
    public R<List<Map<String, String>>> tywx(@RequestBody MsgBo msgBo) throws NoApiKeyException, InputRequiredException {
       // List<Map<String, String>> maps = tywxFactory.basicCall(msgBo.getNewMsg(), 2, "1024*1024");
        return R.ok();
    }

}
